package com.ant.storage.controller;


import com.ant.storage.common.ResultVo;
import com.ant.storage.service.IHistoricalProcurementService;
import com.ant.storage.vo.HistoricalProcurementVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author melon
 * @since 2022-10-25
 */
@RestController
@RequestMapping("/historical-procurement")
@Api(tags = "历史采购接口")
public class HistoricalProcurementController {

    @Autowired
    private IHistoricalProcurementService historicalProcurementService;

    @ApiOperation(value = "历史采购接口")
    @GetMapping("/getHistoricalProcurement")
    public ResultVo getHistoricalProcurement() {
        List<HistoricalProcurementVo> procurementAll =
                historicalProcurementService.getHistoricalProcurementAll();
        return ResultVo.success("获取成功",procurementAll);
    }

    @ApiOperation(value = "历史采购信息")
    @GetMapping("/getHistoricalProcurements/{id}")
    public ResultVo getHistoricalProcurements(@PathVariable("id") Integer id) {
        List<HistoricalProcurementVo> procurementAll =
                historicalProcurementService.getHistoricalProcurements(id);
        return ResultVo.success("获取成功",procurementAll);
    }


}
